import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/home.vue'),
    meta: { title: '主页面' }
  },
  {
    path: '/home1',
    name: 'home1',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/test.vue'),
    meta: { title: '测试页面' }
  }
]

const router = new VueRouter({
  routes
})
router.afterEach((to, from) => {
  // console.log('vueAfterRouter', to, from)
  // document.title = to.meta.title
})

export default router
